package com.vondear.rxui.view.dialog;

import android.app.Activity;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.vondear.rxui.R;
import com.vondear.rxui.view.dialog.RxDialog;


/**
 * @author vondear
 * @date 2017/3/20
 * 封装了从相册/相机 获取 图片 的Dialog.
 */
public class RxDialogShaiXuan extends RxDialog {

    private LayoutType mLayoutType = LayoutType.TITLE;
    private TextView tv_all;
    private TextView tv_nv;
    private TextView tv_nan;
    private TextView tv_btn;
    private Activity context;

    public RxDialogShaiXuan(Context context, int themeResId) {
        super(context, themeResId);
        initView();
    }

    public RxDialogShaiXuan(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
        initView();
    }

    public RxDialogShaiXuan(Context context) {
        super(context);
        initView();
    }

    public RxDialogShaiXuan(Context context, float alpha, int gravity) {
        super(context, alpha, gravity);
        initView();
    }

    public TextView getTv_all() {
        return tv_all;
    }

    public TextView getTv_nv() {
        return tv_nv;
    }

    public TextView getTv_nan() {
        return tv_nan;
    }

    public TextView getTv_btn() {
        return tv_btn;
    }

    public void setAllClickListener(View.OnClickListener listener) {
        tv_all.setOnClickListener(listener);
    }

    public void setNvClickListener(View.OnClickListener listener) {
        tv_nv.setOnClickListener(listener);
    }

    public void setNanClickListener(View.OnClickListener listener) {
        tv_nan.setOnClickListener(listener);
    }

    public void setBtnClickListener(View.OnClickListener listener) {
        tv_btn.setOnClickListener(listener);
    }

    private void initView() {
        View dialogView = LayoutInflater.from(getContext()).inflate(R.layout.dialog_cailiao_choose, null);
        tv_all = dialogView.findViewById(R.id.tv_all);
        tv_nv = dialogView.findViewById(R.id.tv_nv);
        tv_nan = dialogView.findViewById(R.id.tv_nan);
        tv_btn = dialogView.findViewById(R.id.tv_btn);
        setContentView(dialogView);
        mLayoutParams.gravity = Gravity.BOTTOM;
    }


    public enum LayoutType {
        TITLE, NO_TITLE
    }
}
